package org.adorsys.aderp.catal.domain;

import java.math.BigDecimal;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.roo.addon.javabean.RooJavaBean;
import org.springframework.roo.addon.jpa.entity.RooJpaEntity;
import org.springframework.roo.addon.tostring.RooToString;

@RooJavaBean
@RooToString
@RooJpaEntity
public class Product {

    @NotNull
    @Column(name = "productKeyBk", unique = true)
    private String productKey;

    private Boolean composed;

    private Boolean component;

    private String cpi;

    private String title;

    private String shotTitle;

    private String localId;

    private String description;

    private String releaseProduct;

    private String creator;

    @NotNull
    @Temporal(TemporalType.TIMESTAMP)
    @DateTimeFormat(pattern = "dd-MM-yyyy hh:mm:ss")
    private Date dateCreation;

    private String lastModifier;

    @NotNull
    @Temporal(TemporalType.TIMESTAMP)
    @DateTimeFormat(pattern = "dd-MM-yyyy hh:mm:ss")
    private Date dateLastUpdate;

    private Boolean sellingAuthorization;

    @ManyToMany(cascade = CascadeType.ALL)
    private Set<Discount> discounts = new HashSet<Discount>();

    @ManyToOne
    private ProductType productType;

    @ManyToOne
    private Manufacturer manufacturer;

    @ManyToOne
    private ProductClass productClass;

    @ManyToOne
    private Conditioning conditioning;

    @ManyToOne
    private Unit measure;

    private BigDecimal maxSO;

    @ManyToOne
    private Unit maxSOUnit;

    private BigDecimal minSO;

    @ManyToOne
    private Unit minSOUnit;

    @NotNull
    @Temporal(TemporalType.TIMESTAMP)
    @DateTimeFormat(pattern = "dd-MM-yyyy hh:mm:ss")
    private Date dateLastEntry;

    @NotNull
    @Temporal(TemporalType.TIMESTAMP)
    @DateTimeFormat(pattern = "dd-MM-yyyy hh:mm:ss")
    private Date dateLastOuting;

    private BigDecimal maxStockableQty;

    @ManyToOne
    private Unit maxStockableQtyUnit;

    private String posology;

    private String activePrinciples;

    private BigDecimal stockQuantity;

    @ManyToOne
    private Unit stockQuantityUnit;

    private BigDecimal stockPrice;

    private BigDecimal maxPO;

    @ManyToOne
    private Unit maxPOUnit;

    private BigDecimal minPO;

    @ManyToOne
    private Unit minPOUnit;

    private String serviceProvider;

    private String serviceTopic;

    @ManyToOne
    private Container container;

    @ManyToOne
    private SubContainer subContainer;
}
